import { lazy, Suspense } from 'react'

const LazyLoad = (moduleName: string) => {
  const viteModule = import.meta.glob('../pages/**/*.tsx')
  //组件地址
  const URL = `../pages/${moduleName}/index.tsx`
  const Module = lazy(viteModule[`${URL}`] as any)
  // fallback={<Loading />}
  return (
    <Suspense>
      <Module />
    </Suspense>
  )
}
export default LazyLoad
